#! /usr/bin/env python
#coding=utf-8

from django import template

register = template.Library()

@register.filter(name='ago')
def ago(value):
    iDays = (value.now() - value).days
    strResult = ''
    if iDays == 0:
        strResult = 'today'
    elif iDays == 1:
        strResult = 'yesterday'
    else:
        strResult = '%d days ago'%(iDays, )
    return strResult
    

